<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>
<body>
    <!-- 组件模块 -->
    <div id="app">
        <my-aaa></my-aaa>
    </div>

    <!-- 模板 -->
    <template id="aaa">
        <div>
            <h1>这是一个模板组件</h1>
            <ul>
                <li v-for="val in arr">{{val}}</li>
            </ul>
        </div>
    </template>
    <script>
        // 创建Vue的对象
        let vm = new Vue({
            el:"#app",
            components:{
                'my-aaa':{
                    //组件中可以有数据，methods、computed、template
                    data(){
                        return {
                            msg:'hello components',
                            arr:['apple','banana','orange']
                        }
                    },
                    methods: {
                        change(){
                            this.msg = '改变了吧哈哈'
                        }
                    },
                    template:'#aaa'
                }
            }
        })
    </script>
</body>
</html>